#include "vga.h"
#include "string.h"

void 
putchar( char caracter, VGA_MODE mode, int columna, int linea ) {

	caracter_video * pantalla = (void *) VIDEO_BASE;
	
	pantalla += linea * VIDEO_ANCHO + columna;

	pantalla->mode = mode;
	pantalla->caracter = caracter;
	
}

void 
print_str( char * str,VGA_MODE mode, int columna, int linea ) {

	int i, c, l;

	c = columna;
	l = linea;
	for(i = 0; str[i] != '\0'; i++) {

		if (l >= 25) {
			l = 0;
			c = 0;
		}
		if (c >= 80) {
			l++;
			c = 0;
		}
		putchar(str[i], mode, c, l);
		c++;
	}
} 

void
print_int( int n, VGA_MODE mode, int columna, int linea ) {

	char str[16];
	itoa(n, str, 10);
	print_str(str, mode, columna, linea);
}
